Repository navigation
asio: a page's resolver results hold their one entry in place, so that they allocate nothing - #7
Merged
Merged
Conversation
…t resolving, copying and posting them allocate nothing A page resolves no name, and Boost's results took seven operator new for a long host and service: the list, its shared count, the entry's storage and the names' copies. In a page, ip/basic_resolver_results.hpp and ip/basic_resolver_entry.hpp are now owned facades that define webcpp's own types under Boost's names, with the host in a buffer of 254 bytes, DNS's 253 and a final dot, and the service as its port's digits and its leading zeros. A longer host reports host_not_found. Natively and on WASI both headers still forward to Boost's.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
In a page, a resolution's results hold their one entry in place and allocate nothing.
A page looks up no name: its resolver keeps the host and the service for the page's transport. Its results were Boost's
basic_resolver_results, which allocate withnew, taking no allocator:That is 7
operator newfor a long host and a long service, as the browser allocation test measured before this change. It was the one allocation a trystero room still made outside its resource in a page, once per relay connection.ip/basic_resolver_results.hppandip/basic_resolver_entry.hppare owned facades now (upstream/pin.json).webcpp::asio::ip::basic_resolver_resultsandbasic_resolver_entry, under Boost's names and with Boost's members.host_not_found, synchronously, posted, or thrown.webcpp::asio::ip::tcp::resolver::results_typeandwebcpp::asio::ip::basic_resolver_results<tcp>are the same new type. Only code that names Boost's type for a page, or treats its results as an iterator, as Boost's deprecated interface allows, breaks. The changelog marks the change as breaking.Tests
resolver_test, in a page, covers:allocation_test, in a page: a long host and a long service resolve, copy and post with nooperator newand no C library allocation; before the change, 7operator neweach way.Verified locally
libs/asio/teston emscripten: every test passed, thealoneheader tests among them. The only failures in the log are the compile-fail tests, whose errors are expected.resolverandallocation.libs/asio/testnatively: every test passed.alonetests of the three resolver headers on wasip2 and wasip3.libs/beast/testandlibs/trystero/teston emscripten, with this change. trystero's relay allocation test then expects no resolver allocation, in a separate trystero PR.upstream/sync.py --check, clang-format, clang-tidy over the touched units, and the lint's pattern rules.🤖 Generated with Claude Code